package com.huilian.iotbox.data.enums;

import lombok.Getter;

import java.util.stream.Stream;

@Getter
public enum ProductIdEnum {
    _1(1, "12货道格子主板"),
    _50(50, ""),
    _56(56, ""),
    _65(65, ""),
    _67(67, ""),
    _69(69, ""),
    _70(70, ""),
    _73(73, ""),
    _77(77, ""),
    _78(78, ""),
    _85(85, ""),
    _87(87, ""),
    _90(90, ""),
    _95(95, ""),
    _98(98, ""),
    _102(102, ""),
    _103(103, ""),
    _104(104, ""),
    _105(105, ""),
    _107(107, ""),
    _121(121, ""),
    _131(131, ""),
    _139(139, ""),
    _159(159, ""),
    ;
    private Integer code;
    private String desc;

    ProductIdEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static ProductIdEnum getProductId(Integer value) {
        return Stream.of(ProductIdEnum.values())
                .filter(p -> p.code == value)
                .findAny()
                .orElse(null);
    }
}
